/*******************************************************************************
 * Copyright (c) 2008 Sylvain Sicard.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     Sylvain Sicard - initial API and implementation
 ******************************************************************************/
package fr.jade.examples.fraclite.orb.helloworld;

import org.objectweb.fractal.api.control.BindingController;

public class ClientImpl implements Main, BindingController {

  // Bindings
  
  protected static final String serviceItfName = "s";
  protected Service service;
  
  protected static final String[] listItf = new String[] {serviceItfName};
  
  // Main
  public void main (final String[] args) {
    service.print("hello world");
  }

  // BindingController
  public String[] listFc () {
    return listItf;
  }

  public Object lookupFc (final String cItf) {
    if (cItf.equals(serviceItfName)) {
      return service;
    }
    return null;
  }

  public void bindFc (final String cItf, final Object sItf) {
    if (cItf.equals(serviceItfName)) {
      service = (Service)sItf;
    }
  }

  public void unbindFc (final String cItf) {
    if (cItf.equals(serviceItfName)) {
      service = null;
    }
  }
}
